package com.coreJava.chapter3;

import java.util.Arrays;

public class Demo01 {
    public static void main(String[] args) {
        String greeting="Hello";
        int n = greeting.length();
        System.out.println("n = " + n);
        int cpCount = greeting.codePointCount(0, greeting.length());
        System.out.println("cpCount = " + cpCount);
        char first = greeting.charAt(0);
        System.out.println("first = " + first);
        char last = greeting.charAt(4);
        System.out.println("last = " + last);
        System.out.println(greeting.codePointAt(0));//返回指定索引处的字符（Unicode代码点）
        System.out.println(greeting.codePointBefore(5));
        int[] codePoints = greeting.codePoints().toArray();
        System.out.println("Arrays.toString(codePoints) = " + Arrays.toString(codePoints));

        String str=new String(codePoints,0,codePoints.length);
        System.out.println("str = " + str);
        String join = str.join("-", "we", "ni", "re");
        System.out.println("join = " + join);
    }

}

